Apparatus for counting articles by weight

ABSTRACT

Articles such as bank notes or coins are counted by weighing them on a weighing machine ( 100 ). The weighing machine does not itself have the capability to compute the number of items by dividing the total weight by a nominal weight. Instead this and related functions are carried out by an independent computer ( 105 ) which has been programmed with dedicated software. This enables the weighing machine ( 100 ) per se to be cheaper and simpler and the combined apparatus has numerous advantages including greater versatility.

This invention relates to apparatus for counting articles by weight,particularly, but not exclusively, currency in the form of bank notes orcoins.

It is well known to count bank notes or coins by weighing them.GB-A-2115163 discloses apparatus for the purpose and GB-A-2076979 andGB-A-2218218 disclose techniques employed for the purpose. Notes orcoins to be weighed together must all be of the same kind, e.g. £1coins, £5 notes. This normally presents no difficulty because as moneyis taken, e.g. in a retail outlet, it is sorted into differentcompartments of a till drawer. Normally the compartments are fitted withremovable till cups in which the contents of a compartment can betransferred bodily to the hopper of a weighing machine. The weight ofthe container is “known” by the machine and subtracted from the totalweight. The remaining weight is then divided by the average weight ofnotes or coins of the denomination concerned, this average weight beingalso “known” by the machine. In a sophistication of the technique knownas “histogram counting” an item tolerance is used to work out a range ofweights that represent unambiguous counts. If an unambiguous count isrecognised this is used to adjust the average weight, and the adjustedweight is used in subsequent counts.

Weighing machines hitherto used for counting coins and bank notes havebeen stand-alone machines incorporating all the components necessary forweighing the items, for storing an average weight value for theparticular items being weighed and for converting the weight value intoa number which is then displayed by the machine. Thus such machines haveincorporated inter alia a microprocessor capable of storing the data,carrying out the calculations and displaying the results. The cost ofsuch machines is of course a reflection of their complexity.

A principal object of the present invention is to reduce the cost of theprovision of the apparatus while at the same time improving itsperformance and versatility. This is achieved by removing from theweighing machine itself the majority of the computational and displayfunctions and entrusting them instead to an independent computer. Thus aweigh/counting machine in accordance with the present invention ceasesto be a stand-alone item and becomes a peripheral, i.e. it must have asymbiotic relationship with a computer.

Computers are now every day items and are found in numbers in mostoffices. A typical computer has many times the memory and thecomputational power of the microprocessors hitherto used inweigh/counting machines, such that to take over the functions of such amicroprocessor will not impair other functions of the computer. This notonly allows the weigh/counting machine itself to be sold more cheaply,but taking advantage of the greater computing power of the independentcomputer a more powerful and more versatile counting to tool is madeavailable. Customers for the new weigh/counting machines can be assumedalready to possess computers so that their only additional requirementwill be to install on them appropriate, dedicated software.

In accordance with the present invention there is provided apparatus forcounting articles by weight comprising, in combination, a weighingmachine adapted to provide electronic output signals proportional to anumber of articles of similar weight placed on the weighing machine,means for establishing a connection between the weighing machine and acomputer independent of the weighing machine and a computer programadapted to program said computer inter alia to receive and to interpretthe said output signals and to display a value corresponding with thenumber of articles placed on the weighing machine, the apparatus beingcharacterised in that the weighing machine is a computer peripheralwhich has no means for converting weight into displayed numericalvalues.

The program is preferably adapted to program the computer to maintain adialogue with the weighing machine in which the said output signals arecompared with data relating to the average weight of said articles.

The program is preferably adapted to program the computer with averageweight data of categories of articles of different average weight andcommand input means is preferably provided to select the category ofarticles to be weighed by the weighing machine.

The computational capacity of the weighing machine per se may be limitedto a single chip microcontroller.

Said means for establishing a connection may be a cable. Said cable maybe connected at one end to the weighing machine and may have at itsother end a plug for insertion into a port of the independent computer.

Alternatively said means for establishing a connection may be cordless.

A preferred embodiment of the present invention will now be described byway of non-limitative example with reference to the accompanyingdrawing, in which FIG. 1 is a block diagram of apparatus in accordancewith the present invention.

Referring to FIG. 1, the apparatus comprises a weighing machine 100having a load cell 101 fitted with a hopper 102 to receive items to beweighed. The load cell is connected to a micro processor 103 of theweighing machine 100 via an analogue to digital converter 104. The microprocessor 103 controls the converter 104 to derive a filtered digitalvalue representative of the weight on the hopper 102. Raw data about theitems to be counted is provided to the micro processor 103 by anindependent personal computer 105 via a communication port 106.Typically this will include the nominal item weight and the percentagetolerance and the weight of any container such as a bag or till cup inwhich the items to be counted are contained. The micro processor 103uses this raw data to calculate the count of the items on the hod 102and returns this information to the computer 105 via the communicationsport 106 of the weighing machine, which in the example illustrated isconnected to the computer by a cable 107.

The calculation can be done in one of two ways; either by allowing forany container weight and dividing the remaining weight by the nominalweight (rounding the answer to the nearest whole count) or by includingan item tolerance to work out a range of weights that representunambiguous counts. If an unambiguous count is recognised this isreturned to the computer 105 together with a slightly adjusted versionof the nominal weight, which is then used the next time the same itemsare counted. If an ambiguous count is recognised a signal goes to thecomputer 105 whereby it displays on its VDU 108 an indication that someor all of the items on the hopper 102 should be removed. The process isrepeated with a different weight of the items on the hopper 102 until anunambiguous count is found.

This procedure is known as histogram counting and is known per se. It isused for counting items whose nominal weight varies both inherently andwith usage, for example bank notes which have a wide basic weighttolerance which is affected by wear, humidity and dirt build-up.

The computer 105 stores data concerning the nominal weights of a rangeof items to be counted as well as the weight(s) of any containers foritems being weighed. It is programmed to conduct a dialogue with theweighing machine 100.

The following details the protocol of the dedicated software with whichthe computer 105 has been programmed.

The micro processor 103 of the weighing machine maybe a single chip 8051type microcontroller with limited RAM. This is taken into account in theprogram of the computer by limiting the fame lengths, thus allowingrelatively small buffers to be used in the weighting machine.

Frame Format STX  CMD  DATA ETB/ETX CRC STX Start of frame character02h * CMD Command character printable ASCII character * DATA Datacharacters 1 to 17 ASCII hex characters * ETB/ETX End of frame character17h/03h * CRC Cyclic redundancy check 4 ASCII hex characters* these characters are used to compute the CRC.

CRC

The CRC is the industry standard CRC-16, given by the polynomialX¹⁶+X¹⁵+X²+X⁰ (8005 h) and will detect the following errors:

-   All single bit errors-   All 2 bit errors-   All errors with an odd number of error bits-   All burst errors of 16 bits or less-   99.97 of all 17 bit errors.

The choice of the CRC is based on the need for a check sequence of morethan a single byte and on the availability of a tried and testedpolynomial. The initial value of the CRC register is 0000 h and is leftshifted as the CRC is calculated. The message is processed MSB to LSB tocalculate the CRC.

Message Frames

The following gives the details of the messages defined in the protocol:

Computer to Weighing Machine

The frames all have the format outlined above. The command and dataportions of each message type are detailed below.

Count Items

Count items messages contain 3 data elements, each of 4 ASCII hexcharacters representing unsigned integers. The message length includingthe CRC is 23 bytes. STX CMD DATA 1 DATA 2 DATA 3 DATA 4 ETX CRC CMDASCII Hex Count in estimation E 45 mode Count in histogram H 48 modeDATA 1 Item weight (×0.001 g) unsigned integer 4 ASCII hex chars DATA 2Tolerance (×0.1%) note 1 unsigned integer 4 ASCII hex chars DATA 3Package weight (×0.01 g) unsigned integer 4 ASCII hex chars DATA 4Nominal weight (×0.001 g) unsigned integer 4 ASCII hex chars

Separate values may be used for +ve and −ve tolerances. The MS and LSbytes hold the +ve tolerance and −ve tolerance values respectively.

Used in histogram counting—the item weight should be the last learnedweight received when the same item was last counted. The nominal weightis the ideal weight for that item and should remain unchanged. The itemweight must also lie in the range given by the nominal weight with the+ve and −ve tolerances applied.

Store Items

This command is used to store learned weights and other configurationdata in the VLC EEPROM.

Store items messages contain 5 data elements. The total message lengthis 24 bytes. STX CMD DATA 1 DATA 2 DATA 3 DATA 4 DATA 5 ETB/X CRC CMDASCII Hex Set learned weight L 4C Set package weight p 50 Setcalibration C 43 Set configuration ID I 49 DATA 1 Item N ID charprintable ASCII char DATA 2 value N unsigned integer 4 ASCII hex charsDATA 3 value (N + 1) unsigned integer 4 ASCII hex chars DATA 4 value(N + 2) unsigned integer 4 ASCII hex chars DATA 5 value (N + 3) unsignedinteger 4 ASCII hex chars

If there are more items to be stored ETB follows DATA 5; otherwise ETXfollows DATA 5 in the last frame containing items to be stored.

When sending learned weight data as a block of frames, all but the lastframe should have ETB as the end of frame character. The last frame in ablock must have ETX as the end of frame character; otherwise subsequentdata frames will overwrite existing data. Unlike other message types theETX end of frame character does not cause the machine to enter talkmode.

Set learned weight frames can be alternated with set pack weight frames.The frame data is appended to the existing EEPROM data until the memoryoverflows. In the present example 47 stored item frames can be stored intotal.

Sending a set config ID message erases stored items and package datafrom the EEPROM.

Instructions

These are commands to the machine which do not include data. The messagelength including the CRC is 7 bytes. STX   CMD   ETB/X   CRC CMD ASCIIHex Cancel last command (ETB) u 75 Get weight in grams (ETX) g 67 Getraw count (ETX) c 63 Get mean raw count (ETX) m 60 Reset weighingmachine r 72 Get learned weights (ETX) l 6C Get package weights (ETX) p70 Get calibration a 61 Get configuration ID (ETX) o 6F Get status (ETX)s 73 Set ADC zero (ETB) z 7A

Acknowledgements

Acknowledgements are single characters sent by a receiver when a validmessage has been processed. Acknowledgements do not have the standardframe format. Instead a single character is sent twice in successiongiving a message length of 2 bytes. By sending the codes twice theprobability of a random error producing a different valid code is 1 in65536 (1 in 256 with a single character). The acknowledgement is onlyrecognised if both codes are identically received. This is to minimisethe occurrence of deadlocks should a NAK be corrupted in transmission toan ACK. ACK 1 (NAK 1) ACK 2 (NAK 2) Acknowledgement ASCII Hex Positiveacknowledge (Ack) ACK 06 Negative acknowledge (Nak) NAK 15

In what follows Ack and Nak refer to 2 ACKs (NAKs) in succession.

Weighing Machine to Computer

The frames all have the format outlined above. The command and dataportions of each message type are detailed below.

Item Weight or Count

Sent by the weighing machine in response to a count items (‘E’ or ‘H’),get weight in grams (‘g’) or get raw count (‘c’) command from the PC.

Items weight or count messages contain 2 data elements, each of 4 ASCIIhex characters representing unsigned integers. The message lengthincluding the CRC is 15 bytes. STX CMD  DATA 1 DATA 2 ETB   CRC CMDechoes the command from the host that originated the message e.g. ‘H’DATA 1 Item weight or unsigned integer* 4 ASCII hex chars count DATA 2Learned weight unsigned integer 4 ASCII hex charsDATA 1 represents a weight or count depending on CMD.DATA 2 is the new learned weight calculated by the weighing machine whenCMD is count in histogram (‘H’) and is 0000h otherwise.*Grams weight raw count and mean count are signed integers.

Power-Up

On power up or on receipt of a reset command (‘r’) from the computer theweighing machine initiates a reset and enters listen mode. The computerpowers up in talk mode.

Weighing Machine Response to Computer Messages

The weighing machine Acks if the computer is in listen mode, the messageis valid and the weighing machine is ready to process it, and theneither stays in listen mode or prepares to enter talk mode as describedabove. After a time t₄ or on receipt of an Ack from the computer theweighing machine enters talk mode.

If the weighing machine is in listen mode and the message is invalid theweighing machine replies with Nak and stays in listen mode.

If the weighing machine is in talk mode it replies with a busyprocessing last command message (‘J’) and remains in talk mode, exceptwhen the received message is a cancel command (‘c’).

If the message is a cancel command the weighing machine Acks and enterslisten mode. In normal circumstances the weighing machine should neverreceive a message other than a cancel command when in talk mode. Howevera corrupted acknowledgement (e.g. Ack changes to Nak) could cause thisto occur.

Computer Responses to Weighing Machine Acknowledgements

In the case of an Ack received by the computer in response to atransmitted message the computer prepares to enter talk mode or listenmode depending upon the message just Ack'd. If no Ack is received or ifNak is received the computer re-transmits the sent message a maximum ofN times.

If a Nak is received from the last re-transmission or if no Ack has beenreceived the computer assumes a communications failure has occurred. Ifa busy message (‘j’) is received the computer sends a cancel command(‘c’) instead of re-transmitting the last sent message.

After sending a message the Ack or Nak should be received within time t₁otherwise a Nak is assumed. Similarly after receiving the firstcharacter in a message the last character in the message should bereceived within time t₂ for the message to be valid.

After receiving an Ack from the weighing machine to the computer commandwith ETX as the end of frame character, the message following from theweighting machine should be correctly received within time t₃, otherwisea communications failure is assumed. Recovery by the computer from acommunications failure is application dependent.

Computer Response to Weighing Machine Messages

The computer Acks if the computer is in listen mode, the message isvalid and the computer is ready to process it and then either stays inlisten mode or prepares to enter talk mode as described above. After atime T₄ or on receipt of an Ack from the weighing machine the computerenters talk mode.

If the computer is in listen mode and the message is invalid thecomputer replies with Nak and remains in listen mode.

If the computer is in talk mode the computer replies with a cancelcommand (‘c’) and remains in talk mode. In normal circumstances thecomputer should never receive a message when in talk mode. However acorrupted acknowledgement (e.g. Ack changes to Nak) could cause this tooccur.

Weighing Machine Responses to Computer Acknowledgements

In the case of an Ack received by the weighing machine in response to atransmitted message the weighing machine prepares to enter talk mode orlisten mode depending upon the message just, Ack'd. If no Ack isreceived or if Nak is received the weighing machine re-transmits thesent message a maximum of N times.

If a Nak is received from the last re-transmission or if no Ack has beenreceived the weighing machine enters listen mode.

After sending a message the Ack or Nak should be received within time t₁otherwise, a Nak is assumed. Similarly after receiving the firstcharacter in a message the last character in the message should bereceived within time t₂ for the message to be valid.

In the case of an Ack received by the weighing machine in response to anAck sent by the weighing machine (after receiving an ETX message) theweighing machine enters talk or listen mode as appropriate.

Message Re-Transmission and Time Outs

N 2 t₁ 200 ms t₂ 100 ms t₃ t₂ + t₄ + 250 ms t₄ (N * t₁) + 50 ms

The appended Table 1 is illustrative of a typical dialogue between theVLC and host: The system starts in the normal idle state with thecomputer in control. The computer initiates the dialogue (1) sending acommand message (2) to the weighing machine which instructs the weighingmachine to go into Count Histogram mode for the items specified in thedata included in the command. This data typically includes the itemcurrent weight, the weight tolerance, packaging weight and the itemnominal weight. This message is received by the weighing machine whichwill typically produce an Acknowledgement (9) at which point thecomputer will send a further acknowledgement (11) and pass theinitiative to the weighing machine.

The weighing machine may alternatively produce a series of statusmessages in response to the original command (2)—these include NoAcknowledgement (3) and Busy (4). On receipt of these status messagesthe computer performs a series of recovery procedures to try and reachthe correct state. These include use of the Cancel command (5) andrepeated attempts of the original command (1).

Once the weighing machine has the initiative (12) the user can add itemsto the hod 11 and the weighing machine will process the weight changesusing the histogram counting algorithm and produce a resulting histogramcount (13) that is transmitted to the computer. This message typicallycontains the item count and a new learned weight for the item. Thecomputer will acknowledge receipt of this message (14). The process thencontinues (15), (15) (16) as the user adds and removes items until thecomputer retakes the initiative by sending a cancel command (18).

The apparatus herein described, including a computer programmed withdedicated software, has significant advantages over the “stand alone”weigh/counting machine which is currently in use. The weighing machineprotocol used in the present invention uses ASCII only and a cyclicredundancy check (CRC). This is a compromise between good errordetection and efficiency. The longer frames are likely to be used mostof the time and have the higher efficiency. The short command frames areleast efficient but are likely to be used least. Related data is sent ina single frame. Sequential control is addressed by the use ofhalf-duplex transmission and the sequencing control described above.TABLE 1

1. Apparatus for counting articles by weight comprising, in combination,a weighing machine (100) adapted to provide electronic output signalsproportional to a number of articles of similar weight placed on theweighing machine, means (106) for establishing a connection between theweighing machine (100) and a computer (105) independent of the weighingmachine and a computer program adapted to program said computer (105)inter alia to receive and to interpret the said output signals and todisplay a value corresponding with the number of articles placed on theweighting machine (100) characterized in that the weighing machine (100)is a computer peripheral which has no means for converting weight intodisplayed numerical values.
 2. Apparatus as claimed in claim 1,characterized in that the program is adapted to program the independentcomputer (105) to maintain a dialogue with the weighing machine (100) inwhich the said output signals are compared with data relating to theaverage weight of said articles.
 3. Apparatus as claimed in claim 2,characterized in that the program is adapted to program the independentcomputer (105) with average weight data of categories of articles ofdifferent average weight and command input means is provided to selectthe category of articles to be weighed by the weighing machine (100). 4.Apparatus claimed in claim 1, characterized in that the computationalcapacity of the weighing machine (100) is limited to a single chipmicrocontroller (103).
 5. Apparatus claimed in claim 1, characterized inthat said means for establishing a connection comprises a cable (107).6. Apparatus as claimed in claim 5, characterized in that said cable(107) is connected at one end to the weighing machine (100) and has atits other end a plug for insertion into a port of an independentcomputer (105).
 7. Apparatus as claimed in claim 1, characterized inthat said means for establishing a connection is cordless.